package com.mk.admin.service.impl;


import com.mk.admin.mapper.AdminLogMapper;
import com.mk.admin.model.ResultDto;
import com.mk.admin.model.entity.AdminLogEntity;
import com.mk.admin.model.query.AdminLogQuery;
import com.mk.admin.model.vo.AdminLogVo;
import com.mk.admin.service.AdminLogService;
import com.mk.admin.util.JSONCopy;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;


@Service
public class AdminLogServiceImpl implements AdminLogService {

    @Autowired
    private AdminLogMapper adminLogMapper;

    @Override
    public ResultDto add(AdminLogVo vo) {
        return ResultDto.data(adminLogMapper.insert(JSONCopy.copy(vo, AdminLogEntity.class)));
    }

    @Override
    public ResultDto select(AdminLogQuery query) {
        return ResultDto.data(adminLogMapper.count(JSONCopy.copy(query, AdminLogEntity.class)), adminLogMapper.select(JSONCopy.copy(query, AdminLogEntity.class)));
    }

}
